home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
APP
/
E-L
/
IQ_Test.cpt
/
IQ Test ƒ
/
IQ Test Sorce Code ƒ
/
IQ Test.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-02-17
|
1KB
|
69 lines
#include "IQ Test.h"
static void InitToolBox( void );
main()
{
short i,
status = noErr;
DialogPtr theDialog;
EventRecord theEvent;
/*
Expand the application heap
Initialize the toolbox
Initialize the random number generator.
Bring the program to the front. Give time to other processes to let
them catch up.
Perform the test.
*/
MaxApplZone();
InitToolBox();
GetDateTime( &qd.randSeed );
FlushEvents( everyEvent, NO_STOP_MASK );
for ( i = 0; i < 6; i++ )
WaitNextEvent( everyEvent, &theEvent, 6, NIL_PTR );
/*
If you think the program is too malicious, uncomment the next line
of code to provide a dialog that warns the user to save files.
status = DoWarningDialog();
*/
if ( noErr == status )
DoTest();
}
void InitToolBox()
{
InitGraf( &qd.thePort );
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs( NIL_PTR );
InitCursor();
}
void CenterAsAlert(
DialogPtr theDialog )
{
Point dlogTopLeft;
/*
Center as an Alert the window of a dialog.
*/
dlogTopLeft.h = ( ( screenBits.bounds.right - screenBits.bounds.left ) -
( ( *theDialog ).portRect.right - ( *theDialog ).portRect.left ) ) / 2;
dlogTopLeft.v = ( ( screenBits.bounds.bottom - screenBits.bounds.top ) -
( ( *theDialog ).portRect.bottom - ( *theDialog ).portRect.top ) ) / 3;
MoveWindow( theDialog, dlogTopLeft.h, dlogTopLeft.v, LEAVE_WHERE_IT_IS );
}